﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SqlCeViewer.CommonMethod;
using SqlCeViewer.Moduls;
using System.ServiceProcess;
using SqlCeViewer.Base;
using SqlCeViewer.UI;

namespace SqlCeViewer.Moduls
{
    public partial class DataExchange : BaseSubForm
    {
        public DataExchange()
        {
            InitializeComponent();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Access2SDF sf = new Access2SDF();
            sf.Owner = this;
            sf.ShowDialog();
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            SqlServer2Sdf ssf = new SqlServer2Sdf();
            ssf.Owner = this;
            ssf.ShowDialog();
        }

        private void simpleButton3_Click(object sender, EventArgs e)
        {
            CommonUtil.ResultArgs args = CommonUtil.DetectMySqlService();
            if (!args.HasThisService)
            {
                MessageBox.Show("You do not has mysql database installed ,or not running the service");
                return;
            }
            if (args.status != ServiceControllerStatus.Running)
            {
                if (!CommonUtil.StartServices(CommonUtil.MySqlServiceName))
                {
                    MessageBox.Show("Your mysql database can't run .Process will cancel");
                    return;
                }
            }

            MySql2SDF msdf = new MySql2SDF();
            msdf.Owner = this;
            msdf.ShowDialog();
        }

        private void simpleButton4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Not Completed");
        }

        private void simpleButton5_Click(object sender, EventArgs e)
        {
            Excel2Sdf sf = new Excel2Sdf();
            sf.Owner = this;
            sf.ShowDialog();
        }
    }
}